<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>分析</title>

    <script src="js/zucai.js"></script>
    <link  rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <script src="js/hotime-v2.js" type="text/javascript"></script>
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
<style>
    .cont{
        padding:30px;}
    .quancheng{font-size: 20px ;font-weight: blod; text-align: center;
        padding:10px;}
</style>
</head>
<body>
<div class="container-fluid cont">
    <div class="quancheng"></div>
    <div class="lunci"></div>

<table class="table table-bordered table-striped table-hover">
    <thead>
    <tr>
        <td>公司</td>
        <td>即时水</td>
        <td>即时盘</td>
        <td>即时水水</td>
        <td>时间</td>
        <td>初始水</td>
        <td>初始盘</td>
        <td>初始水</td>
        <td>变化时间</td>
        <td>主</td>
        <td>客</td>
        <td>同</td>
        <td>此轮胜负</td>
        <td>赛前第一次预测</td>
        <td>赛前第二次预测</td>
        <td>赛前第三次预测</td>
        <td>描述</td>
    </tr>
    </thead>
    <tbody>
    <tr h="tr">
        <td>{quancheng}</td>
        <td>{ping}</td>
        <td>{pan}</td>
        <td>{ying}</td>
        <td>{time}</td>
        <td>{cping}</td>
        <td>{cpan}</td>
        <td>{cying}</td>
        <td>{ctime}</td>
        <td ><a href="{masterhref}" target="_blank">主</a></td>
        <td><a href="{slavehref}" target="_blank">客</a></td>
        <td><a href="{synchref}" target="_blank">同</a></td>
        <td>{win}</td>
        <td>{a0}</td>
        <td>{a1}</td>
        <td>{a2}</td>
        <td>{key}</td>
    </tr>

    </tbody>
</table>
</div>
<script>
    function request(paras) {
        var url = location.href;
        var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
        var paraObj = {}
        for (i = 0; j = paraString[i]; i++) {
            paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
        }
        var returnValue = paraObj[paras.toLowerCase()];
        if (typeof (returnValue) == "undefined") {
            return "";
        } else {
            //t=new String(returnValue.getBytes("ISO8859_1"),"UTF-8");
            //return t;
            return returnValue;
        }
    }




    var Info={
        create:function () {
            this.C.init();
        },
        replacePan:function (a) {
            var temp=a.replace(" ","");
            temp=temp.replace("升","");
            temp=temp.replace("降","");
//            temp=temp.replace("受","");
            return temp;
        },
        replacePing:function (a) {
            var temp=a.replace(" ","");
            temp=temp.replace("↓","");
            temp=temp.replace("↑","");
            temp=Number(temp);
            return temp;
        },
        shuiPing:function (temp) {
            console.log(temp)
            if(temp>=1){
                return 2;//高水
            }
            if(temp>=0.9){//中水
                return 1;
            }
            return 0;//低水
        },
        huansuan:function (huansuan) {
//            console.log(huansuan)
            if(huansuan>0){
                huansuan=3;
            }else if(huansuan==0){
                huansuan=5;
            }else{
                huansuan=4;
            }
            return huansuan;
        },
        setAnswer:function (i,key) {

            var k=Info.data[i]["tcpan"].replace("受","");
//            console.log(k)
            if(Pan[k]==null){
                return;
            }

            if(Pan[k][key]["c0"]!=null){
                Info.data[i]["a0"]=Answer[Pan[k][key]["c0"]];
            }
            if(Pan[k][key]["c1"]!=null){
                Info.data[i]["a1"]=Answer[Pan[k][key]["c1"]];
            }
            if(Pan[k][key]["c2"]!=null){
                Info.data[i]["a2"]=Answer[Pan[k][key]["c2"]];
            }
        },
        jielun:function (i,key) {
            var len=Object.keys(Key).length;



            console.log(key)
            if(key[3]=="5"){
                key= Info.data[i]["tcpan"].replace("受","")+"盘不变"+","+key.substr(0,3)
            }else{
                key= Info.data[i]["tcpan"].replace("受","")+"盘"+key.substr(3,key.length).replace(":","")+","+key.substr(0,3)
            }

//            console.log(key.substr(3,key.length))
            var temp=null;

            while(temp!=key){
                temp=key;

                for(var j=0;j<len;j++){
                    key=key.replace(j,Key[j]);
                }

            }

//            console.log(Info.data[i])
            Info.data[i]["key"]=key;
        }
    };

    Info.C={
        data:null,
        init:function () {
            $('.quancheng').text(decodeURI(request("quancheng"))+"    队伍："+decodeURI(request("bmasterteam"))+"-----"+decodeURI(request("bslaveteam")));
            $('.lunci').text(decodeURI(request("blunci"))+"   时间："+decodeURI(request("btime")));
            if(request("type")=="0"){
                $('.lunci').text($('.lunci').text()+"  来源于：live.500.com")
            }else{
                $('.lunci').text($('.lunci').text()+"  来源于：win007.com")
            }
            H.post("app/ball/fenxi",{fid:H.tool.getParam("fid"),type:H.tool.getParam("type")},function (res) {
                if(res.statu!=0){
                    alert(res.result);
                    return;
                }

                Info.data=res.result;
//                for(var i=0;i<Info.data.length;i++){
//                    Info.data[i]["tpan"]=Info.replacePan(Info.data[i].pan);
//                    Info.data[i]["tcpan"]=Info.replacePan(Info.data[i].cpan);
//                    //初始盘口是否为受
//                    if(Info.data[i].cpan.indexOf("受")){
//                        Info.data[i]["tping"]=Info.replacePing(Info.data[i].ping);
//                        Info.data[i]["tcping"]=Info.replacePing(Info.data[i].cping);
//                    }else{
//                        Info.data[i]["tping"]=Info.replacePing(Info.data[i].ying);
//                        Info.data[i]["tcping"]=Info.replacePing(Info.data[i].cying);
//                    }
//
//                    console.log(Info.data[i])
//
//
//                    Info.data[i]["shui"]=Info.shuiPing(Info.data[i].tping);
//                    Info.data[i]["cshui"]=Info.shuiPing(Info.data[i].tcping);
//
//                    var huansuanPan=Info.huansuan(HuanSuan[Info.data[i]["tpan"]]-HuanSuan[Info.data[i]["tcpan"]]);//盘口升降
//                    var huansuanPing=Info.huansuan(Info.data[i]["tping"]-Info.data[i]["tcping"]);//水位升降
////                    console.log(Info.data[i]["tping"])
////                    console.log(Info.data[i]["tcping"])
//                    var key=Info.data[i]["tcpan"];
//
//                        var temp=""+Info.data[i]["cshui"]+""+huansuanPing+""+Info.data[i]["shui"];
//
//                        //是否去除临时盘受
//                        if (key.indexOf("受")!=-1) {
//                            var temp1 = temp + huansuanPan + ":" + Info.data[i]["tpan"].replace("受","");
//                        }else{
//                            var temp1 = temp + huansuanPan + ":" + Info.data[i]["tpan"];
//                        }
//
//                        //查找pan库并获取Answer结果
//                        if(Pan[key.replace("受","")]!=null&&Pan[key.replace("受","")][temp1]!=null){
//
//                                Info.setAnswer(i,temp1);//二级答案
//
//                        }
//                        //拼接字符串
//                        Info.jielun(i,temp1);
//                    if(Info.data[i]["a0"]==null){
//                        Info.data[i]["a0"]='';
//                    }
//                    if(Info.data[i]["a1"]==null){
//                        Info.data[i]["a1"]='';
//                    }
//                    if(Info.data[i]["a2"]==null){
//                        Info.data[i]["a2"]='';
//                    }
//                    if(Info.data[i]["key"]==null){
//                        Info.data[i]["key"]='';
//                    }
//                }

                $("table tbody").html(H.tpt.output("tr",res.result,function (res) {
                    if(H.getParam("win")==1){
                        res.win="下盘胜"
                    }else{
                        res.win="暂无";
                    }
                }))
            })
        },

    };
    Info.create();
</script>
</body>
</html>